package com.le.tester.book.effectivejava3rdchinese.articlethree;

/**
 * createTime：2022/7/29 11:18
 * description：使用私有的构造方法或枚举实现
 */
public class Elvis {
    //首先使用私有的构造器
    private Elvis() {
    }

    private static final Elvis INSTANCE = new Elvis();


    public static Elvis getInstance() {

        return INSTANCE;
    }

    private Object readResolve() {
        return INSTANCE;
    }

    public static void main(String[] args) {
        Elvis instance = Elvis.INSTANCE;
    }
}

